package com.april.pattern.behavioral.templatemethod;

/**
 * @author April
 * @version V1.0.0
 * @date 2019/07/08 22:52
 * @description
 */
public abstract class AbstractCourse {
    protected final void makeCourse() {
        this.makePPT();
        this.makeVideo();
        if (needWriteArticle()) {
            this.writeArticle();
        }
        this.packageCourse();
    }

    /**
     * 打包课程方法
     */
    abstract void packageCourse();

    final void makePPT() {
        System.out.println("制作PPT");
    }

    final void makeVideo() {
        System.out.println("制作视频");
    }

    final void writeArticle() {
        System.out.println("编写手记");
    }

    /**
     * 钩子方法
     *
     * @return
     */
    protected boolean needWriteArticle() {
        return false;
    }
}
